Constants

What is a constant?

Like variables, constants are used to represent data in a task that may be different from machine to machine. But unlike variables, constants cannot be modified during a task's execution (also known as "read only"). Furthermore the value of a constant is available to all tasks on the system (also known as "global"). Before constants can be used they must be configured, for example UserName, favorite color, or whatever else you need to use in a centrally created task that might differ from machine to machine. Because constants are "global" they are configured from within the Task Administrator | Options dialog rather than the task itself.

AutoMateÖ tasks may be designed on one machine and run on others û either by exporting and importing or by deploying a task via remote administration. Because of this, sometimes it is necessary to specify a path to a file or any other piece of information that may be different from machine to machine. It is impractical to design a separate task for each machine û for instances such as this, AutoMateÖ allows the use of Constants.

Constants can act to make tasks more portable, as they can easily convey information to the task at runtime about the current environment.

Example

Constants may be used in any AutoMateÖ step parameter by specifying the name of the constant surrounded by % signs as show in the example below.

If Machine 1 has Microsoft Office installed in

 c:\office

and Machine 2 has Microsoft Office installed in

D:\MSO

When adding a Run action you could use specify a defined global constant followed by the EXE name.

 %OFFICEFOLDER%\winword.exe

in the path.

When the task is run on the target machines, AutoMateÖ resolves the value at runtime to the appropriate value û which in this case is the directory of Microsoft Office (without the trailing backslash).

Notes

Be careful that constant names used do not conflict with a BASIC keyword, function or instruction. A common way to avoid this is to insert your own text to the beginning of all constant names. For example: the text "CONST" - so that "DIR" (which is a BASIC keyword) would become "CONSTDIR" thus avoiding any name conflict.

See Also:

Using Expressions

Variables

 

(Microsoft Office is a trademark of Microsoft Corp.)